package ex2.employee;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class CEquipmentHandler implements IEquipmentHandler {

	Collection<IEquipment> _equipment;
	
	public CEquipmentHandler(){
		this._equipment = new ArrayList<IEquipment>();
	}
	
	
	@Override
	public double getCost(String equipmentName) {
		double tAnswer = 0;
		
		for(Iterator<IEquipment> iterator = this._equipment.iterator(); tAnswer==0 & iterator.hasNext();){
			
			IEquipment tEquipment = iterator.next();
			if(tEquipment.getName().equals(equipmentName))
				tAnswer = tEquipment.getCost();
		}
		
		return tAnswer;
	}

	@Override
	public void addEquipment(IEquipment equipment) {
		this._equipment.add(equipment);

	}


	@Override
	public boolean isAvailable(String equipment) {
		// TODO Auto-generated method stub
		return false;
	}


	@Override
	public void remove(String equipment) {
		// TODO Auto-generated method stub
		
	}

}
